import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

/// FileName loading
///
/// @Author lax
/// @Date 2023/11/8
///
/// @Description

class Loading {
  static bool get isShow => EasyLoading.isShow;

  static void init() {
    EasyLoading.instance
          ..displayDuration = const Duration(milliseconds: 2000)
          ..indicatorType = EasyLoadingIndicatorType.fadingCircle
          ..loadingStyle = EasyLoadingStyle.custom
          ..indicatorSize = 45.0
          ..radius = 10.0
          ..maskColor = Colors.transparent
          ..backgroundColor = Colors.transparent
          ..progressColor = Colors.white
          ..indicatorColor = Colors.white
          ..textColor = Colors.white
          ..userInteractions = true
          ..dismissOnTap = false
        // ..customAnimation = CustomAnimation()
        ;
  }

  static void show([String? message = 'loading...']) {
    EasyLoading.show(
      status: message == '' ? null : message,
      maskType: EasyLoadingMaskType.clear,
    );
  }

  static void dismiss() {
    EasyLoading.dismiss();
  }
}
